home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group95b.txt
/
000042_icon-group-sender _Fri Jun 16 10:51:39 1995.msg
< prev
next >
Wrap
Internet Message Format
|
1995-09-18
|
3KB
Received: by cheltenham.cs.arizona.edu; Fri, 16 Jun 1995 12:29:08 MST
Message-Id: <v01520d03ac076c61d971@[199.35.110.124]>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Date: Fri, 16 Jun 1995 10:51:39 -0800
To: icon-group@cs.arizona.edu
From: bobalex@netcom.com (Bob Alexander)
Subject: Re: Best and worst features of Icon (was: ICON vs Ted Nelson)
Errors-To: icon-group-errors@cs.arizona.edu
>From: scott@cs.arizona.edu (Scott E Gilbert)
>Personally, I'd like to see the &null value act as a general purpose
>identity for all of the operators except when used as a procedure call. For
>example:
>
> 1 + &null -> 1
> 1 * &null -> 0
> 'abc' ++ &null -> 'abc'
> "foo" || &null -> "foo"
> [1,2,3] ||| &null -> [1,2,3]
> &null(1, 2, 3) -> Obscure Runtime Error: 169
>
>I'd probably even extend this to other "operators" such as those that work
>on lists, tables and sets.
Interestingly, the behavior you suggest was present in SNOBOL4, Icon's
grandparent. I'd bet the reason for the absense of default behaviors for
&null is that those behaviors can be the source of obscure bugs. I know I
personally catch lots of errors when I try to add a number to a variable
that doesn't exist (i.e. was misspelled) -- usually my first seven errors
in any new program!
Another argument for no default behaviors: a program is more transparent
(in a readability sense) if the expected initial value of a variable is
explicitly set -- if it isn't you might have to scan back in a procedure to
make sure it didn't have some value left from a previous use. This can
bite you for "static" variables, too.
On the other hand, since &null is the often-used equivalent of boolean
"false", it *does* have a default behavior for that usage.
Bottom line: although sometimes I wish for the cuteness of not having to
initialize a variable before I use it, I tend to prefer the existing
handling of &null. I'm willing to put in the extra line of code (which
makes my program more readable), and bear the extra millisecond and few
bytes added to my program.
What I *do* wish for sometimes, though, is a generic non-null value, to
provide symmetry for boolean usage -- something like &true (although using
1 or "true" isn't really all that bad).
My biggest Icon wish: better connection with the real world (i.e.
interface to C -- this is probably Icon's worst handicap).
By the way, the preferred spelling is "Icon", not "ICON" (as pointed out in
the FAQ).
Bob Alexander
bobalex@netcom.com